package com.hyt.it.ogt.kq.service.bm.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hyt.core.base.BaseEntity;
import com.hyt.it.ogt.kq.common.bm.enums.BmAuditStatusEnum;
import com.hyt.it.ogt.kq.common.bm.enums.BmProjectNeedAuditEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 报名项目
 * </p>
 *
 * @author wangt
 * @since 2020-05-15
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ToString(callSuper = true)
@TableName("bm_project")
@ApiModel(value = "Project对象", description = "报名项目")
public class Project extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "项目名称")
    private String projectName;

    @ApiModelProperty(value = "机构名称id")
    private String officeId;

    @ApiModelProperty(value = "部门ID")
    private String deptId;

    @ApiModelProperty(value = "状态:0:未发布,1:已发布")
    private Integer status;

    @ApiModelProperty(value = "是否审核")
    private Integer isVerify;

    @ApiModelProperty(value = "报名开始时间")
    private LocalDateTime beginTime;

    @ApiModelProperty(value = "结束时间")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "海报地址")
    private String postersUrl;

    @ApiModelProperty(value = "二维码地址")
    @TableField("qr_code_url")
    private String qrCodeUrl;

    @ApiModelProperty(value = "报名地址")
    private String address;

    @ApiModelProperty(value = "最多报名科目数")
    private Integer maxSubject;

    @ApiModelProperty(value = "最少报名科目数")
    private Integer minSubject;

    @ApiModelProperty(value = "缴费开始时间")
    private LocalDateTime payBeginTime;

    @ApiModelProperty(value = "缴费结束时间")
    private LocalDateTime payEndTime;

    @ApiModelProperty(value = "审核开始时间")
    private LocalDateTime auditBeginTime;

    @ApiModelProperty(value = "审核结束时间")
    private LocalDateTime auditEndTime;

    @ApiModelProperty(value = "描述")
    private String description;

    @ApiModelProperty(value = "完成状态0 创建报名1采集信息2创建科目3创建完成")
    private Integer completeState;

    @ApiModelProperty(value = "订单更新状态update_order_state(0：未启动，1：已启动)")
    private Integer updateOrderState;

    @ApiModelProperty(value = "是否允许退款（0：允许，1：不允许）")
    private Integer isRefund;

    @ApiModelProperty(value = "是否需要缴费:0不需要,1需要")
    private Integer isPay;

    @ApiModelProperty(value = "是否有报名须知:0-没有(默认),1-有")
    private Integer isNotice;

    @ApiModelProperty(value = "是否开启人证比对")
    private Integer isCompare;

    @ApiModelProperty(value = "是否开放性报名:0非开放性,1开放性	")
    private Integer isOpen;

    @ApiModelProperty(value = "是否需要打印准考证:0否,1是	")
    private Integer isNeedAdmission;

    @ApiModelProperty(value = "打印准考证开始时间	")
    private LocalDateTime admissionBeginTime;

    @ApiModelProperty(value = "打印准考证结束时间	")
    private LocalDateTime admissionEndTime;

    @ApiModelProperty(value = "退费截止时间")
    private LocalDateTime refuseTime;

    @ApiModelProperty(value = "平台项目绑定情况：1-绑定，0-解绑(未绑定)，默认0")
    private int ptBangFlag;
    
    
    
    public static Integer getStudentAuditStatus(Integer projectIsVerify) {
        // 如果项目需要审核则
        return  BmProjectNeedAuditEnum.NEEDAUDIT.getAuditStatus().equals(projectIsVerify) ? BmAuditStatusEnum.PENDINGAPPROVAL.getAuditStatus() : BmAuditStatusEnum.APPROVED.getAuditStatus();
    }

}
